<template>
	<view class="flex-col page">
		<scroll-view scroll-y="true" style="height: 95vh;" @scrolltolower="loadmore">
			<view class="flex-col group" v-if="list.length>0">
				<view class="flex-col section_1 view" v-for="(item,index) in list" :key="index" @click="jump(item)">
					<view class="flex-row">
						<image :src="imgUrl+'16557826792503103103.png'" class="image_1" />
						<text class="text_1">{{item.reportsType}}</text>
					</view>
					<view class="justify-between group_2">
						<text class="text_3">你的房屋位置</text>
						<text class="text_5">{{item.provinceName}} {{item.cityName}} {{item.districtName}}</text>
					</view>
					<view class="flex-col group_3">
						<view class="justify-between">
							<text class="text_7">你的房屋面积</text>
							<text class="text_9">{{item.roomArea}}m²</text>
						</view>
						<view class="justify-between group_5">
							<text class="text_11">房屋类型</text>
							<text class="text_13">{{item.roomTypeName}}</text>
						</view>
						<view class="justify-between group_5">
							<text class="text_11">文件名</text>
							<text class="text_13 fileName">{{item.address}}</text>
						</view>
						<!-- <view class="justify-between group_5">
							<text class="text_11">文件名</text>
							<text class="text_13 fileName">{{item.name}}{{sliceIdx}}</text>
						</view> -->
						<view class="flex-col group_6">
							<!-- <text class="text_15">注：预览文件只可预览word，pdf，excle，jpg格式文件。可在PC端进行下载。</text> -->
							<!-- <view style="height: 1px;background-color: #f0f0f0;"></view> -->
							<view class="flex-row justify-end u-m-t-20"
								v-if="item.judge==6 || item.judge==4 || item.judge==9">
								<view class="text_11 item-center-my">查看</view>
								<view class="u-m-l-20 text_11 item-center-my" v-if="item.judge==6 ||  item.judge==9"
									@click.stop="invitation">分享</view>
							</view>
							<shop-share v-model="share"></shop-share>
							<view class="justify-end group_7" v-if="check(item.address)">
								<view class="flex-col items-center text-wrapper view_5"><text class="text_16"
										@click.stop="preview(item.address)">查看图片</text></view>

								<view class="flex-col items-center text-wrapper" @click.stop="invitation"><text
										class="text_18">分享图片</text></view>

							</view>
							<view class="tips">
								注: 预览文件只可预览word、pdf、excle、jpg格式文件。可在pc端进行下载。
							</view>
							<view class="justify-end group_7" v-if="checkWord(item.address)">
								<view class="flex-col items-center text-wrapper view_5"><text class="text_16"
										@click.stop="filepreview(item.address)">预览文件</text></view>
							</view>
						</view>
					</view>
				</view>

			</view>
			<view style="height: 100vh;" v-else>
				<u-empty mode="data" width="250" marginTop="60%" textSize="30rpx"
					icon="http://cdn.uviewui.com/uview/empty/data.png">
				</u-empty>
			</view>
		</scroll-view>
		<u-loadmore v-show="more" height="100" fontSize="26" :status="status" />
		<shop-share v-model="share"></shop-share>
		<mumu-previewOffce :fileUrl='fileUrl' v-model='showPreview'></mumu-previewOffce>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				// sliceIdx:'',
				fileUrl: '',
				showPreview: false,
				more: false,
				show: false,
				share: false,
				status: 'loading',
				imgUrl: this.$IMG_URL,
				list: [],
				param: {
					pageSize: 10,
					pageNum: 1
				},
			};
		},
		created() {
			this.getList();
		},
		methods: {
			getList(type = 0) {
				this.$http('check.queryReports', this.param).then(r => {
					if (r.code == 200) {
						
						
						if (type == 0) {
							this.list = r.data;
							// r.data.forEach(item=>{
							// 	console.log(item);
							// 	let idx = item.address.lastIndexOf('.')
							// 	 this.sliceIdx = item.address.slice(77)
							// 	console.log(idx,sliceIdx);
							// })
						} else {

							if (r.data.length > 0) {
								this.list = this.list.concat(r.data);
								this.status = "loadmore";
							} else {
								this.status = "nomore";

							}

						}

					}
				});
			},
			filepreview(url) {
				this.showPreview = true;
				this.fileUrl = url;
			},
			jump(item) {
				console.log(item);
				if (item.judge == 6) {
					this.go('/pages/my/order/checkFWDetail?ordersId=' + item.ordersId);
				} else if (item.judge == 4) {
					this.go('/pages/my/order/feedbackXJY?ordersId=' + item.ordersId);
				} else if (item.judge == 9) {
					this.go('/pages/my/report/reportDetails?projectId='+item.projectId)
				}

			},
			loadmore() {
				this.status = "loading";
				this.more = true;
				this.param.pageNum++;
				this.getList(1)
			},
			check(url) {
				if (url) {
					let arr = url.split('.');
					let end = arr[arr.length - 1];
					return end == 'jpg' || end == "jpeg" || end == 'png' || end == "gif";
				} else {
					return false;
				}

			},
			checkWord(url) {
				if (url) {
					let arr = url.split('.');
					let end = arr[arr.length - 1];

					return end == 'doc' || end == "docx" || end == 'xls' || end == "csv" || end == "pptx" || end == "pdf";
				} else {
					return false;
				}

			},
			preview(url) {
				uni.previewImage({
					urls: [url],
					longPressActions: {
						itemList: ['发送给朋友', '保存图片', '收藏'],
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},
			loadmore() {

			},
			refuse() {
				this.show = true;
			},
			invitation() {
				this.share = true;
			}
		},
	};
</script>

<style scoped lang="scss">
	.tips {
		line-height: 24px;
		font-size: 24rpx;
		color: #ff371d;
	}
	.fileName {
		display: flex;
		justify-content: flex-end;
		width: 520rpx;
	}
	.item-center-my {
		display: flex;
		justify-content: center;
		align-items: center;
		width: 100rpx;
		height: 32rpx;
		padding: 20rpx;
		background-color: #f6f6f7;
		border-radius: 50px;
	}

	.section_1 {
		margin-top: 20rpx;
		padding: 29rpx 22rpx 32rpx 23rpx;
		background-color: #ffffff;
		border-radius: 16rpx;
		margin-bottom: 20rpx;
	}

	.image_1 {
		margin-top: 18rpx;
		width: 26rpx;
		height: 16rpx;
	}

	.text-wrapper {
		padding: 5rpx 0 15rpx;
		background-color: #f6f7f9;
		border-radius: 24rpx;
		width: 148rpx;
		height: 48rpx;
	}

	.group_7 {
		margin-top: 39rpx;
		padding-top: 25rpx;
		border-top: solid 1rpx #eeeeee;
	}

	.divider {
		margin-top: 40rpx;
		background-color: #eeeeee;
		border-radius: 0.5rpx;
		height: 1rpx;
	}

	.text-wrapper_1 {
		margin-top: 24rpx;
		align-self: flex-end;
		padding: 5rpx 0 15rpx;
		background-color: #f6f7f9;
		border-radius: 24rpx;
		width: 148rpx;
	}

	.text_3 {
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.text_11 {
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_13 {
		color: #191919;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_60 {
		color: #333333;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_16 {
		color: #333333;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_18 {
		color: #333333;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

	}

	.group_2 {
		margin-top: 40rpx;
	}

	.group_3 {
		margin-top: 39rpx;
	}

	.text_1 {
		margin-left: 16rpx;
		color: #191919;
		font-size: 32rpx;
		font-weight: bolder;
		font-family: '.AppleSystemUIFont';

	}

	.text_5 {
		margin-right: 3rpx;
		color: #191919;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.group_5 {
		margin-top: 33rpx;
	}

	.text_7 {
		margin-bottom: 6rpx;
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_9 {
		margin-top: 6rpx;
		color: #191919;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.view_5 {
		margin-right: 20rpx;
	}

	.text_55 {
		margin-bottom: 6rpx;
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_57 {
		margin-top: 6rpx;
		color: #191919;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.page {
		background-color: #f6f7f9ff;
		width: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		min-height: 100vh;
	}

	.group {
		padding: 21rpx 24rpx 24rpx;
		flex: 1 1 auto;
		overflow-y: auto;
	}

	.view {
		margin-top: 0;
	}

	.section_2 {
		margin-top: 20rpx;
		padding: 29rpx 22rpx 31rpx 24rpx;
		background-color: #ffffff;
		border-radius: 16rpx;
	}

	.section_3 {
		margin-top: 20rpx;
		padding: 29rpx 22rpx 0 24rpx;
		background-color: #ffffff;
		border-radius: 16rpx;
	}

	.group_12 {
		margin-top: 40rpx;
	}

	.group_19 {
		margin-top: 40rpx;
	}

	.group_20 {
		margin-top: 39rpx;
	}

	.group_23 {
		margin-top: 40rpx;
		padding: 25rpx 2rpx 30rpx;
		border-top: solid 1rpx #eeeeee;
	}

	.group_6 {
		margin-top: 33rpx;
	}

	.group_10 {
		margin-top: 33rpx;
	}

	.text_30 {
		margin-left: 16rpx;
		color: #191919;
		font-size: 32rpx;
		font-family: '.AppleSystemUIFont';

	}

	.group_14 {
		margin-top: 39rpx;
	}

	.group_15 {
		margin-top: 33rpx;
	}

	.text_39 {
		margin-left: 16rpx;
		color: #191919;
		font-size: 32rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_40 {
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_41 {
		margin-right: 3rpx;
		color: #191919;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.group_22 {
		margin-top: 33rpx;
	}

	.view_17 {
		margin-right: 20rpx;
	}

	.group_26 {
		margin-top: 39rpx;
	}

	.group_30 {
		margin-top: 39rpx;
	}

	.group_34 {
		margin-top: 33rpx;
	}

	.text_15 {
		color: #ff371d;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

		text-align: left;
	}

	.text_27 {
		color: #ff371d;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 28rpx;
		text-align: left;
	}

	.text_31 {
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_32 {
		margin-right: 3rpx;
		color: #191919;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_33 {
		margin-bottom: 6rpx;
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_34 {
		margin-top: 6rpx;
		color: #191919;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.group_17 {
		margin-top: 40rpx;
		padding: 25rpx 2rpx 0;
		border-top: solid 1rpx #eeeeee;
	}

	.text_42 {
		margin-bottom: 6rpx;
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_43 {
		margin-top: 6rpx;
		color: #191919;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_44 {
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_45 {
		color: #191919;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_46 {
		color: #333333;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_47 {
		color: #333333;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_59 {
		margin-top: 27rpx;
		color: #ff371d;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

		text-align: left;
	}

	.text_71 {
		margin-top: 27rpx;
		color: #ff371d;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

		text-align: left;
	}

	.text_80 {
		color: #ff371d;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

		text-align: left;
	}

	.text_35 {
		color: #666666;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_36 {
		color: #191919;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';

	}

	.view_15 {
		margin-right: 20rpx;
	}

	.text_81 {
		color: #333333;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_37 {
		color: #333333;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

	}

	.text_38 {
		color: #333333;
		font-size: 24rpx;
		font-family: '.AppleSystemUIFont';

	}
</style>
